home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / include / user / RCS / sysStats.h,v < prev    next >
Encoding:
Text File  |  1992-07-17  |  15.5 KB  |  444 lines

  1. head     1.5;
  2. branch   ;
  3. access   ;
  4. symbols  srv030:1.5 srv027:1.5 srv026:1.5 srv024:1.5 srv021:1.5 srv019:1.5 srv018:1.5 srv016:1.5 srv014:1.4 srv010:1.4 srv008:1.4 srv007:1.3 srv006:1.2 srv005:1.2 srv004:1.2 srv003:1.2;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.5
  10. date     92.06.23.12.19.43;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.4;
  13.  
  14. 1.4
  15. date     92.06.02.14.58.06;  author kupfer;  state Exp;
  16. branches ;
  17. next     1.3;
  18.  
  19. 1.3
  20. date     92.05.27.21.20.31;  author kupfer;  state Exp;
  21. branches ;
  22. next     1.2;
  23.  
  24. 1.2
  25. date     92.04.29.21.25.56;  author kupfer;  state Exp;
  26. branches ;
  27. next     1.1;
  28.  
  29. 1.1
  30. date     92.04.29.13.53.04;  author kupfer;  state Exp;
  31. branches ;
  32. next     ;
  33.  
  34.  
  35. desc
  36. @@
  37.  
  38.  
  39. 1.5
  40. log
  41. @Add SYS_NET_GEN_STATS.
  42. @
  43. text
  44. @/*
  45.  * sysStat.h --
  46.  *
  47.  *    User-level definitions of routines and types for system statistics
  48.  *    returned by the Sys_Stats system call.  Instead of a /dev/kmem
  49.  *    type interface, we have calls to return specific kernel structure.
  50.  *    The kernel call takes the following arguments:
  51.  *    Sys_Stats(command, option, argPtr)
  52.  *    commands are defined below, and option and argPtr are interpreted
  53.  *    differently by each command.  Typically argPtr is a buffer that
  54.  *    gets filled in with a system structure, and option is used to
  55.  *    indicate the size, or to control tracing, or isn't used at all.
  56.  *
  57.  * Copyright 1986, 1988 Regents of the University of California
  58.  * Permission to use, copy, modify, and distribute this
  59.  * software and its documentation for any purpose and without
  60.  * fee is hereby granted, provided that the above copyright
  61.  * notice appear in all copies.  The University of California
  62.  * makes no representations about the suitability of this
  63.  * software for any purpose.  It is provided "as is" without
  64.  * express or implied warranty.
  65.  *
  66.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/sysStats.h,v 1.4 92/06/02 14:58:06 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  67.  *
  68.  */
  69.  
  70. #ifndef _SYSSTATS
  71. #define _SYSSTATS
  72.  
  73. /*
  74.  * Commands for the Sys_Stats system call.
  75.  *    SYS_RPC_CLT_STATS - Return the Rpc_CltStats structure that contains
  76.  *        client-side statistics for the RPC system. (see rpc.h)
  77.  *    SYS_RPC_SRV_STATS - Return the Rpc_SrvStats structure that contains
  78.  *        server-side statistics for the RPC system. (see rpc.h)
  79.  *    SYS_SYNC_STATS - Return the Sync_Instrument structure which
  80.  *        contains lock and wakeup counts. (see kernel/sync.h)
  81.  *    SYS_SCHED_STATS - Return the Sched_Instrument structure which
  82.  *        contains idle time and context switch counts (kernel/sched.h)
  83.  *    SYS_VM_STATS - Return the Vm_Stat structure which contains every
  84.  *        concievable VM statistic, fault counts etc. (kernel/vmStat.h)
  85.  *    SYS_RPC_TRACE_STATS - Used to both return the trace of recent RPCs,
  86.  *        and to enable/disable the trace, see options below.
  87.  *    SYS_FS_PREFIX_STATS - Return entries from the prefix table. (see fs.h)
  88.  *    SYS_PROC_TRACE_STATS - Used to both return the process migration
  89.  *        trace, and to enable/disable the trace, see options below.
  90.  *    SYS_SYS_CALL_STATS - Return the array of system call counters.
  91.  *        option indicates how many integers the buffer argPtr contains.
  92.  *    SYS_RPC_SERVER_HIST - Return the service time histogram for the RPC
  93.  *        indicated by option. (see kernel/rpcHistogram.h)  If option
  94.  *        is less than or equal to zero the histogram is cleared.
  95.  *    SYS_RPC_CLIENT_HIST - Return service time as obseved by a client.
  96.  *    SYS_NET_GET_ROUTE - Return the route table entry for a particular host.
  97.  *        The data returned are three integers: flags, spriteID, and
  98.  *        route type.  This is then followed by type specific data,
  99.  *        either an ethernet address or an internet address.
  100.  *    SYS_RPC_SRV_STATE - Return the RpcServerState structure for the
  101.  *        RPC server indexed by option.  (see kernel/rpcServer.h)
  102.  *    SYS_RPC_CLT_STATE - Return the RpcClientState structure for the
  103.  *        RPC client channel indexed by option.  (see kernel/rpcClient.h)
  104.  *    SYS_NET_ETHER_STATS - Return the Net_EtherStats structure which
  105.  *        contains interface statistics.  (see kernel/net.h)
  106.  *    SYS_RPC_ENABLE_SERVICE - Enable/disable the service side of the RPC
  107.  *        system.  A non-zero option value enables, zero disables.
  108.  *    SYS_GET_VERSION_STRING - Return the kernel version string.  option
  109.  *        indicates how big the users buffer is.
  110.  *    SYS_PROC_MIGRATION - Enable/Disable process migration to this host.
  111.  *        See options defined below.
  112.  *    SYS_DISK_STATS - Return the Sys_DiskStats structure defined below.
  113.  *        option corresponds to a kernel controller table index.
  114.  *    SYS_FS_PREFIX_EXPORT - Return the export list of a prefix.  The
  115.  *        option parameter indicates the size of the buffer argPtr.
  116.  *        argPtr should contain the prefix upon entry, and is
  117.  *        overwritten with an integer array of SpriteIDs that
  118.  *        corresponds to the export list for the prefix.
  119.  *    SYS_LOCK_STATS - Return the locking statistics. option indicates the
  120.  *        size of the buffer in units of Sync_LockStat structures.
  121.  *    SYS_RPC_SRV_COUNTS - Return the count of RPC service calls.  The
  122.  *        option argument is unused.  If argPtr == NULL then the
  123.  *        counts are printed on the console, otherwise it should be
  124.  *        the address of an integer array size RPC_LAST_COMMAND+1
  125.  *    SYS_RPC_CALL_COUNTS - Return the count of RPC calls.  The
  126.  *        option argument is unused.  If argPtr == NULL then the
  127.  *        counts are printed on the console, otherwise it should be
  128.  *        the address of an integer array size RPC_LAST_COMMAND+1
  129.  *    SYS_LOCK_RESET_STATS - Reset the locking statistics.
  130.  *    SYS_INST_COUNTS - Return information from instruction counts. This
  131.  *        only works on special spur kernels.
  132.  *    SYS_RESET_INST_COUNTS - Reset instruction counts.
  133.  *    SYS_RECOV_STATS - Return information about the recov module.
  134.  *    SYS_RECOV_PRINT - Change printing level of recov module traces.
  135.  *    SYS_FS_RECOV_INFO - Return info with names about the state of
  136.  *        files for recovery testing.
  137.  *    SYS_RECOV_CLIENT_INFO - Dump state on server about per-client recovery.
  138.  *    SYS_RPC_SERVER_TRACE - Turn tracing of rpc servers on or off.
  139.  *    SYS_RPC_SERVER_INFO - Return rpc server tracing info to user.
  140.  *    SYS_RPC_SERVER_FREE - Free up space used by rpc server tracing.
  141.  *    SYS_RPC_SET_MAX - Set the maximum number of server processes.
  142.  *    SYS_RPC_SET_NUM - Create enough server processes to have this many.
  143.  *    SYS_RPC_NEG_ACKS - Turn on or off negative acks on the server.
  144.  *    SYS_RPC_CHANNEL_NEG_ACKS -  Set client policy on or off for handling
  145.  *        neg acks by ramping down the number of client channels.
  146.  *    SYS_RECOV_ABS_PINGS - Whether to use absolute ping intervals or not.
  147.  *    SYS_RECOV_PRINT - Set the recovery print level.
  148.  *    SYS_RPC_NUM_NACK_BUFS - Set the number of negative acknowledgement
  149.  *        buffers.
  150.  *    SYS_START_STATS - Turn on the kernel's periodic printing of sched
  151.  *        and io stats.  TEMPORARY for recovery measurements.
  152.  *    SYS_END_STATS - Turn off the kernel's periodic printing of sched
  153.  *        and io stats.  TEMPORARY for recovery measurements.
  154.  *    SYS_TRACELOG_STATS - Trace log buffer commands (for SOSP91 paper).
  155.  *      SYS_DEV_CHANGE_SCSI_DEBUG - Change debug level for scsi driver.
  156.  *      SYS_SYS_CALL_STATS_ENABLE - Turn on or off system call profiling.
  157.  *      SYS_PROC_SERVERPROC_TIMES - Display the instrumentation for 
  158.  *          Proc_ServerProcs. 
  159.  *    SYS_NET_GEN_STATS - Return the Net_GenStats structure which 
  160.  *            contains generic instrumentation about a network interface.
  161.  *    SYS_RPC_SANITY_CHECK - Toggle sanity checks on rpc packets.
  162.  *    SYS_FS_EXTRA_STATS - Extra fs stats that should go into fsStats for
  163.  *                the next global compile.
  164.  */
  165.  
  166. #define SYS_RPC_CLT_STATS    1
  167. #define SYS_RPC_SRV_STATS    2
  168. #define SYS_SYNC_STATS        3
  169. #define SYS_SCHED_STATS        4
  170. #define SYS_VM_STATS        5
  171. #define SYS_RPC_TRACE_STATS    6
  172. #define SYS_FS_PREFIX_STATS    7
  173. #define SYS_PROC_TRACE_STATS    8
  174. #define SYS_SYS_CALL_STATS    9
  175. #define SYS_RPC_SERVER_HIST    10
  176. #define SYS_RPC_CLIENT_HIST    11
  177. #define SYS_NET_GET_ROUTE    12
  178. #define SYS_RPC_SRV_STATE    13
  179. #define SYS_RPC_CLT_STATE    14
  180. #define    SYS_NET_ETHER_STATS    15
  181. #define SYS_RPC_ENABLE_SERVICE    16
  182. #define SYS_GET_VERSION_STRING    17
  183. #define SYS_PROC_MIGRATION    18
  184. #define    SYS_DISK_STATS        19
  185. #define SYS_FS_PREFIX_EXPORT    20
  186. #define SYS_LOCK_STATS        21
  187. #define SYS_RPC_SRV_COUNTS    22
  188. #define SYS_RPC_CALL_COUNTS    23
  189. #define SYS_LOCK_RESET_STATS    24
  190. #define SYS_INST_COUNTS        25
  191. #define SYS_RESET_INST_COUNTS    26
  192. #define SYS_RECOV_STATS        27
  193. #define SYS_FS_RECOV_INFO    28
  194. #define    SYS_RECOV_CLIENT_INFO    29
  195. #define    SYS_RPC_SERVER_TRACE     30
  196. #define    SYS_RPC_SERVER_INFO    31
  197. #define    SYS_RPC_SERVER_FREE    32
  198. #define    SYS_RPC_SET_MAX        33
  199. #define    SYS_RPC_SET_NUM        34
  200. #define    SYS_RPC_NEG_ACKS    35
  201. #define    SYS_RPC_CHANNEL_NEG_ACKS    36
  202. #define SYS_RECOV_ABS_PINGS    37
  203. #define SYS_RECOV_PRINT        38
  204. #define    SYS_RPC_NUM_NACK_BUFS    39
  205. #define    SYS_TRACELOG_STATS    40
  206. #define SYS_START_STATS        100
  207. #define SYS_END_STATS        101
  208. #define SYS_DEV_CHANGE_SCSI_DEBUG 102
  209. #define SYS_SYS_CALL_STATS_ENABLE 103
  210. #define SYS_PROC_SERVERPROC_TIMES 104
  211. #define SYS_NET_GEN_STATS    105
  212. #define SYS_RPC_SANITY_CHECK    107
  213. #define SYS_FS_EXTRA_STATS    108
  214.  
  215.  
  216. /*
  217.  * Options for the Sys_Stats SYS_RPC_TRACE_STATS command.  If the option
  218.  * is a positive value then that number of trace records are returned
  219.  * into the buffer referenced by argPtr.
  220.  */
  221. #define SYS_RPC_TRACING_PRINT    -1
  222. #define SYS_RPC_TRACING_OFF    -2
  223. #define SYS_RPC_TRACING_ON    -3
  224.  
  225. /*
  226.  * Options for the Sys_Stats SYS_PROC_TRACE_STATS command.  Use these
  227.  * values for the option argument to the Test_Stats call when using
  228.  * the PROC_TRACE_STATS command.  Any argument greater than the
  229.  * largest positive defined constant is the number of trace records to
  230.  * copy into the output buffer (i.e., it is not permissible to copy
  231.  * only 1-3 records).
  232.  */
  233. #define SYS_PROC_TRACING_PRINT    1
  234. #define SYS_PROC_TRACING_OFF    2
  235. #define SYS_PROC_TRACING_ON    3
  236.  
  237. /*
  238.  * Options for the Sys_Stats SYS_PROC_MIGRATION command.
  239.  * ALLOW, REFUSE, and GET_STATUS are obsoleted by GET_STATE and SET_STATE.
  240.  *
  241.  *   SYS_PROC_MIG_ALLOW        - allow all migrations to this machine.
  242.  *   SYS_PROC_MIG_REFUSE    - refuse all migrations to this machine.
  243.  *   SYS_PROC_MIG_GET_STATUS    - get whether all migrations are allowed
  244.  *                  or refused.
  245.  *   SYS_PROC_MIG_SET_DEBUG    - set the migration debug level.
  246.  *   SYS_PROC_MIG_GET_VERSION    - get the migration version.
  247.  *   SYS_PROC_MIG_GET_STATE    - get the general migration state.
  248.  *   SYS_PROC_MIG_SET_STATE    - set it.
  249.  *   SYS_PROC_MIG_SET_VERSION    - set the migration version.
  250.  *   SYS_PROC_MIG_GET_STATS    - get statistics.
  251.  *   SYS_PROC_MIG_RESET_STATS    - reset statistics.
  252.  */
  253. #define SYS_PROC_MIG_ALLOW        0
  254. #define SYS_PROC_MIG_REFUSE        1
  255. #define SYS_PROC_MIG_GET_STATUS        2
  256. #define SYS_PROC_MIG_SET_DEBUG        3
  257. #define SYS_PROC_MIG_GET_VERSION    4
  258. #define SYS_PROC_MIG_GET_STATE        5
  259. #define SYS_PROC_MIG_SET_STATE        6
  260. #define SYS_PROC_MIG_SET_VERSION    7
  261. #define SYS_PROC_MIG_GET_STATS        8
  262. #define SYS_PROC_MIG_RESET_STATS    9
  263.  
  264. /*
  265.  * Options for SYS_TRACELOG_STATS.
  266.  */
  267. #define SYS_TRACELOG_ON        1
  268. #define SYS_TRACELOG_OFF    2
  269. #define SYS_TRACELOG_DUMP    3
  270. #define SYS_TRACELOG_RESET    4
  271. /* 
  272.  * Structure to return SYS_TRACELOG_STATS.
  273.  */
  274. typedef struct Sys_TracelogRecord {
  275.     int        recordLen;    /* Size of this record in bytes. */
  276.     int        time[2];    /* (Timer_Ticks) Timestamp. */
  277.     ClientData    data;        /* Arbitrarily long data. */
  278. } Sys_TracelogRecord;
  279.  
  280. #define SYS_TRACELOG_KERNELLEN 32
  281. #define SYS_TRACELOG_TYPELEN 8
  282. /*
  283.  * This is the header we write to the user level file.
  284.  * Note: things are in somewhat of a state of flux.  The current status is:
  285.  * File is stored as:
  286.  *   magic #
  287.  *   Sys_TracelogHeader
  288.  *   A bunch of records
  289.  * The fields: numBytes, numRecs, and lostRecords are not used.
  290.  * The traceDir is filled in by the user-level dump program.
  291.  * Lost records are indicated by a special record type in the file.
  292.  * The reason for this format is that it is inconvenient to have the length
  293.  * in the header, since any routine post-processing data and writing a
  294.  * new file would have to go back and modify the header after it knew
  295.  * how many records it had.  This way, you write out a fixed header and
  296.  * then whatever records you want.
  297.  */
  298. typedef struct Sys_TracelogHeader {
  299.     int        numBytes;    /* Total size of the records in bytes. */
  300.                 /* Flags are stored in the high 2 bytes. */
  301.     int        numRecs;    /* Number of records. */
  302.     int        machineID;    /* ID of this machine. */
  303.     char    kernel[SYS_TRACELOG_KERNELLEN];    /* Kernel we're running. */
  304.     char    machineType[SYS_TRACELOG_TYPELEN]; /* Machine type. */
  305.     int        bootTime[2];    /* Time of boot (to convert of trace time. */
  306.     int        lostRecords;    /* Records lost from overflow. */
  307.     int        traceDir[4];    /* FileID of the trace directory. */
  308. } Sys_TracelogHeader;
  309.  
  310. /*
  311.  * This is the structure returned by the kernel.
  312.  */
  313. typedef struct Sys_TracelogHeaderKern {
  314.     int        numBytes;    /* Total size of the records in bytes. */
  315.                 /* Flags are stored in the high 2 bytes. */
  316.     int        numRecs;    /* Number of records. */
  317.     int        machineID;    /* ID of this machine. */
  318.     char    kernel[SYS_TRACELOG_KERNELLEN];    /* Kernel we're running. */
  319.     char    machineType[SYS_TRACELOG_TYPELEN]; /* Machine type. */
  320.     int        bootTime[2];    /* Time of boot (to convert of trace time. */
  321.     int        lostRecords;    /* Records lost from overflow. */
  322. } Sys_TracelogHeaderKern;
  323.  
  324. #define LOST_TYPE 128
  325.  
  326. #define TRACELOG_FLAGMASK 0xf0000000
  327. #define TRACELOG_TYPEMASK 0x0fff0000
  328. #define TRACELOG_BYTEMASK 0x0000ffff
  329.  
  330. #define TRACELOG_MAGIC 0x44554d50
  331. #define TRACELOG_MAGIC2 0x44554d51
  332.  
  333. /*
  334.  * Structure to return for disk stats.
  335.  */
  336. #define    SYS_DISK_NAME_LENGTH    100
  337. typedef struct Sys_DiskStats {
  338.     char    name[SYS_DISK_NAME_LENGTH];    /* Type of disk. */
  339.     int        controllerID;            /* Which controller it is. */
  340.     int        numSamples;            /* Number of times idle time
  341.                          * was sampled. */
  342.     int        idleCount;            /* Number of times disk was
  343.                          * idle when sampled. */
  344.     int        diskReads;            /* The number of sector reads 
  345.                          * from this disk. */
  346.     int        diskWrites;            /* The number of sector writes
  347.                          * from this disk. */
  348. } Sys_DiskStats;
  349.  
  350. #ifdef SOSP91
  351.  
  352. #include <spriteTime.h>
  353.  
  354. typedef    struct    Sys_SchedOverallTimes {
  355.     Time    kernelTime;
  356.     Time    userTime;
  357.     Time    userTimeMigrated;
  358. } Sys_SchedOverallTimes;
  359.  
  360. /*
  361.  * Statistics for name lookup on client.
  362.  */
  363. typedef struct Sys_SospNameStats {
  364.     Time    totalNameTime;
  365.     Time    nameTime;
  366.     Time    prefixTime;
  367.     Time    miscTime;
  368.     int        numPrefixLookups;
  369.     int        numComponents;
  370.     int        numPrefixComponents;
  371. } Sys_SospNameStats;
  372. #endif SOSP91
  373.  
  374. extern ReturnStatus        Sys_Stats();
  375.  
  376. #endif /* _SYSSTATS */
  377. @
  378.  
  379.  
  380. 1.4
  381. log
  382. @Add SYS_PROC_SERVERPROC_TIMES command.
  383. @
  384. text
  385. @d23 1
  386. a23 1
  387.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/sysStats.h,v 1.3 92/05/27 21:20:31 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  388. d63 1
  389. a63 1
  390.  *     SYS_RPC_ENABLE_SERVICE - Enable/disable the service side of the RPC
  391. d116 2
  392. d168 1
  393. @
  394.  
  395.  
  396. 1.3
  397. log
  398. @Clean up comments for Sys_Stats commands.
  399. @
  400. text
  401. @d23 1
  402. a23 1
  403.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/sysStats.h,v 1.2 92/04/29 21:25:56 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  404. d114 2
  405. d165 1
  406. @
  407.  
  408.  
  409. 1.2
  410. log
  411. @Flush SOSP91 commands.  Add command to enable/disable system call
  412. timing.
  413. @
  414. text
  415. @d23 1
  416. a23 1
  417.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/sysStats.h,v 1.1 92/04/29 13:53:04 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  418. d113 1
  419. a113 4
  420.  *    SYS_SCHED_MORE_STATS - More counters from the sched module (SOSP91).
  421.  *    SYS_FS_SOSP_MIG_STATS - Counters from the fs module (SOSP91).
  422.  *    SYS_FS_SOSP_NAME_STATS - Undocumented flag of Ken's (SOSP91).
  423.  *    SYS_FSCACHE_EXTRA_STATS - Info about cache blocks (SOSP91).
  424. @
  425.  
  426.  
  427. 1.1
  428. log
  429. @Initial revision
  430. @
  431. text
  432. @d23 1
  433. a23 1
  434.  * $Header: /sprite/src/lib/include/RCS/sysStats.h,v 2.35 91/05/29 09:12:19 mendel Exp $ SPRITE (Berkeley)
  435. d165 1
  436. a165 6
  437. #ifdef SOSP91
  438. #define    SYS_SCHED_MORE_STATS    103
  439. #define    SYS_FS_SOSP_MIG_STATS    104
  440. #define    SYS_FS_SOSP_NAME_STATS    105
  441. #define    SYS_FSCACHE_EXTRA_STATS    106
  442. #endif SOSP91
  443. @
  444.